<template>
  <div class="detail-container" v-loading="loading">
    <div style="position: absolute;top:200px;left:50%;z-index:99" v-if="orderInfo.activityType == 'paiMai'">
      <img src="https://pic.moresu.com/FoLUFEezn2bbN7xNd4iaiKHNwpQM" />
    </div>
    <div style="position: absolute;top:200px;left:50%;z-index:99" v-if="orderInfo.activityType == 'seckill'">
      <img src="https://pic.moresu.com/FvTqdZI0-8JbMLVmy7zYyTU69S94" />
    </div>
     <el-card shadow="never" style="margin-top: 15px;position: relative">
      <div class="operate-container">
        <i class="el-icon-warning color-danger" style="margin-left: 20px"></i>
          <span class="color-danger">当前合同流转状态：{{orderInfo.orderStateStr}}</span>
          <span style="font-size: 16px;color: rgb(0, 140, 216);padding-left: 49px; font-weight: bold;">金蝶更新日期：{{orderInfo.kingUpdateTime}}</span>
<!-- <el-button type="primary" @click="syncOneOrder" :loading="btnLoading5" style="float:right;margin-top:20px;margin-right:20px">同步SAP内容</el-button>-->
<!-- <el-button type="text" style="float:right;margin-top:20px;margin-right:20px" @click="goBlack">< 返回</el-button>-->
      </div>
      <div style="margin-top: 20px">
        <svg-icon icon-class="marker" style="color: #606266"></svg-icon>
        <span class="font-small">基本信息</span>
      </div>
      <el-card shadow="never" style="margin-top:20px;">
        <img src="../../assets/images/yue2.png" v-if="orderInfo.isTimeSure==1" style="position: absolute;left: 10px;top: 57px;z-index: 5;"/>
        <el-form  size="mini" label-width="150px" class="minRoW">
            <el-row>
                <el-col :span="8">
                    <el-form-item label="订单编号：">{{orderInfo.orderSn}}</el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="摩塑网订单号：">{{orderInfo.moresuSn}}</el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="下单日期：">{{orderInfo.createTime}}</el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="8">
                    <el-form-item label="订单数量：">{{orderInfo.orderGoodsNumber}}</el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="订单金额：">{{orderInfo.orderAmount}}</el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="业务员：">{{orderInfo.userName}}</el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="8">
                    <el-form-item label="物流方式：">{{orderInfo.sendType}}</el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="合同公司：">{{orderInfo.fromCompany}}</el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="合同截止付款时间：">{{orderInfo.expectPayTime}}</el-form-item>
                </el-col>
            </el-row>
           <el-row>
               <el-col :span="8">
                   <el-form-item label="结算方式：">{{orderInfo.orderRemark}}</el-form-item>
               </el-col>
               <el-col :span="16">
                   <el-form-item label="合同其它备注：">
                       {{orderInfo.contractOtherRemark}}
                   </el-form-item>
               </el-col>
           </el-row>
            <el-row>
                <el-col :span="8">
                    <el-form-item label="明确合同约定时间：">
                        <span :style="{color:orderInfo.isTimeSure==1 ? 'red' : ''}"> {{orderInfo.isTimeSure | fifterTimeSure}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="财务状态：">{{orderInfo.financeState | fiffinanceState}}</el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="财务操作时间：">{{orderInfo.financeTime}}</el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="8">
                    <el-form-item label="订单来源：" >
                        <span style="color:red">
                             {{orderInfo.isMoresuOnlineOrder == 1 ? '推广订单' : '销售订单'}}
                        </span>
                    </el-form-item>
                </el-col>
                <el-col :span="8" v-if="orderInfo.isMoresuOnlineOrder == 1">
                    <el-form-item label="推广订单是否需要审核：" >
                        {{orderInfo.isMoresuNeedCheck == 1 ? '是' : '否'}}
                    </el-form-item>
                </el-col>
                <el-col :span="8" >
                    <el-form-item label="发票是否开明细：" >
                        {{orderInfo.isInvoiceNeedDetail == 1 ? '是' : orderInfo.isInvoiceNeedDetail == 0 ? '否' : ''}}
                    </el-form-item>
                </el-col>

                <el-col :span="8" >
                    <el-form-item label="是否为维护合同：" >
                        <span style="font-size:18px;font-weight: bold;color:red" v-if="orderInfo.isDefendOrder == 1">是</span>
                        <span v-else>否</span>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" >
                <el-form-item label="推荐人：" >
                  {{ orderInfo.introduceName}}<span v-if="orderInfo.introduceMobile != ''">（{{orderInfo.introduceMobile}}）</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" >
                <el-form-item label="支付方式：" >
                  {{ orderInfo.transactionType}} <span v-if="orderInfo.transactionType == '帐期'">{{orderInfo.periodDay}}天</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" >
                <el-form-item label="是否为特殊订单：" >
                  {{ orderInfo.isZ == 1 ? '是' : '否'}}
                </el-form-item>
              </el-col>
            </el-row>
          <el-row>
            <el-col :span="8" >
              <el-form-item label="订单分类：" >
                {{ orderInfo.orderCustomerType}}
              </el-form-item>
            </el-col>
            <el-col :span="8" >
              <el-form-item label="是否分批来款，分批发货：" label-width="166px">
                {{orderInfo.isBatchPaid == 1 ? '是' : '否'}}
              </el-form-item>
            </el-col>
            <el-row>
              <el-col :span="8" >
                <el-form-item label="是否后结算：" label-width="166px">
                  {{orderInfo.isDelaySettleOrder == 1 ? '是' : '否'}}
                </el-form-item>
              </el-col>
            </el-row>
          </el-row>

<!--            <el-row>-->
<!--                <el-col :span="24">-->
<!--                    <el-form-item label="客户特殊需求：" >-->
<!--                        <span style="font-weight:bold">{{orderInfo.buyerRemark}}</span>-->
<!--                    </el-form-item>-->
<!--                </el-col>-->
<!--            </el-row>-->

          </el-form>
      </el-card>

      <el-row :gutter="20" style="margin-top:20px">
        <el-col :span="orderInfo.orderSendType == '采购发货' ? 8 :12">
          <el-card class="box-card" shadow="never" style="min-height:300px">
            <div slot="header" class="clearfix">
              <span>客户信息</span>
            </div>
              <el-form  size="mini" label-width="120px" class="minRoW"  :rules="rules5" ref="basic" :model="orderInfo">
                  <el-form-item label="客户编号：">
                      <span>
                          {{orderInfo.customerNumber}}
                      </span>
                      <span v-if="orderInfo.isPa6Used==1" class="title-tab">PA6</span>
                      <span v-if="orderInfo.isPa66Used==1" class="title-tab">PA66</span>
                      <span v-if="orderInfo.isPcUsed==1" class="title-tab">PC</span>
                      <span v-if="orderInfo.isAbsUsed==1" class="title-tab">ABS</span>
                      <span v-if="orderInfo.isOtherUsed==1" class="title-tab">其它</span>
                      <span v-if="orderInfo.hasAgreement == 1" class="title-tab" style="color:#fff;background: rgb(249, 177, 73);cursor: pointer" @click="toDetail('10')">质</span>
                      <span style="font-size: 12px;vertical-align: middle;display: inline-block;margin-left: 15px;color: #409eff;background: #ecf5ff;border: 1px solid #b3d8ff;height: 24px;line-height: 24px;padding: 0 10px; border-radius: 5px; cursor: pointer" @click="toDetail">
                          {{orderInfo.customerGrade}}
                      </span>
                  </el-form-item>
                <el-form-item label="客户名称：" v-if="orderInfo.isShowCustomerName">
                      <span> {{orderInfo.customerName}} </span>
                </el-form-item>
                <el-form-item label="客户标签：">
                  <crm-tag :item="item" v-for="item in orderInfo.customerTag" :key="item.tagName" style="margin-bottom:4px;margin-right:4px"></crm-tag>
                </el-form-item>
                  <el-form-item label="客户行业：">
                      <el-select v-model="orderInfo.customerIndustry.cdd_id" v-if="orderInfo.customerIndustry" :disabled="orderInfo.isNeedMyCheck == 0 || (orderInfo.orderState != 20 && orderInfo.orderState != 40)">
                          <el-option :value="item.cddId" :label="item.cddValue" :key="item.cddId" v-for="item in customerIndustryList"></el-option>
                      </el-select>
                  </el-form-item>
                  <el-form-item label="合同类型：">
                      <el-select v-model="orderInfo.orderType" :disabled="orderInfo.isNeedMyCheck == 0|| ( orderInfo.isCanChangeOrderType == 0)">
                          <el-option value="normal" label="正常" key="normal"></el-option>
                          <el-option value="un_sure" label="待定" key="un_sure"></el-option>
                      </el-select>
                  </el-form-item>
                  <el-form-item label="历史成交数据：">
                      <div style="line-height: 16px;padding-top:5px;">{{orderInfo.successNumStatistics}}</div>
                      <div style="line-height: 16px">{{orderInfo.lastOrderMsg}}</div>
                  </el-form-item>
                  <el-form-item label="采购评级：" prop="customerLabel">
                      <el-select v-model="orderInfo.customerLabel" :disabled="orderInfo.isNeedMyCheck == 0">
                          <el-option
                                  key="A类"
                                  label="A类   长期合作，信誉良好，价格铭感度低（排前20%）。"
                                  value="A类">
                          </el-option>
                          <el-option
                                  key="B类"
                                  label="B类   通过努力可以发展成A类客户。"
                                  value="B类">
                          </el-option>
                          <el-option
                                  key="C类"
                                  label="C类   看重价格，合作前三单每笔合同最多给64吨（2车）。"
                                  value="C类">
                          </el-option>
                          <el-option
                                  key="D类"
                                  label="D类  缺乏感恩之心，不遵守自己的承诺。"
                                  value="D类">
                          </el-option>
                          <el-option
                                  key="E类"
                                  label="E类  新客户"
                                  value="E类">
                          </el-option>
                      </el-select>
                  </el-form-item>

                  <el-form-item label="分类：" prop="isSpecialOrder" v-if="orderInfo.isNeedMyCheck && (orderInfo.orderState == 20 || orderInfo.orderState == 25)">
                      <el-radio-group v-model="orderInfo.isSpecialOrder">
                          <el-radio :label="1">是</el-radio>
                          <el-radio :label="0">否</el-radio>
                      </el-radio-group>
                  </el-form-item>
                  <el-form-item label="分类："  v-else>
                      <el-radio-group v-model="orderInfo.isSpecialOrder" disabled>
                          <el-radio :label="1">是</el-radio>
                          <el-radio :label="0">否</el-radio>
                      </el-radio-group>
                  </el-form-item>
              </el-form>
          </el-card>
        </el-col>
        <el-col :span="8" v-show="orderInfo.orderSendType == '采购发货'">
          <el-card class="box-card" shadow="never" style="height:300px">
            <div slot="header" class="clearfix">
              <span>收货信息</span>
            </div>
              <el-form  size="mini" label-width="120px" class="minRoW">
                  <el-form-item label="收货人：">{{orderInfo.receiverName}}</el-form-item>
                  <el-form-item label="收货人手机号：">{{orderInfo.receiverMobile}}</el-form-item>
                  <el-form-item label="收货地址：">{{orderInfo.addressInfo}}</el-form-item>
              </el-form>
          </el-card>
        </el-col>
        <el-col :span="orderInfo.orderSendType == '采购发货' ? 8 :12">
              <el-card class="box-card" shadow="never" style="height:300px">
                  <div slot="header" class="clearfix">
                      <span>未关闭订单</span>
                  </div>
                  <el-table
                          height="200"
                          ref="orderItemTable"
                          :data="orderInfo.unCloseOrderList"
                          style="width: 100%" border>
                      <el-table-column label="订单号" align="center">
                          <template slot-scope="scope">
                            <span style="font-size:12px;vertical-align: middle">{{scope.row.orderSn}}</span>
                          </template>
                      </el-table-column>
                      <el-table-column label="订单时间" align="center">
                          <template slot-scope="scope">
                              {{scope.row.orderTime}}
                          </template>
                      </el-table-column>
                      <el-table-column label="未发货数量" align="center">
                          <template slot-scope="scope">
                              {{scope.row.unSendNum}}
                          </template>
                      </el-table-column>
                      <el-table-column label="付款状态" align="center">
                          <template slot-scope="scope">
                              {{scope.row.payState}}
                          </template>
                      </el-table-column>
                      <el-table-column label="合同上传状态" align="center">
                          <template slot-scope="scope">
                              {{scope.row. isHasContract}}
                          </template>
                      </el-table-column>
                  </el-table>
              </el-card>
          </el-col>
      </el-row>

         <div style="margin-top: 20px">
             <svg-icon icon-class="marker" style="color: #606266"></svg-icon>
             <span class="font-small">客户信用</span>
         </div>

         <table cellspacing="0" cellpadding="0" style="width:100%;margin-top:10px" class="tongJitable" v-if="orderInfo.orderStatistics">
             <tr>
                 <td rowspan="4" class="bgtd" align="center">
                     <div style="font-weight:bold;font-size:16px;margin-bottom:5px;">{{orderInfo.orderStatistics.orders}}</div>
                     合同总数
                 </td>
                 <td class="bgtd"><div class="tddiv blurth">取消总数</div></td>
                 <td class="bgtd"><div class="tddiv">当日取消数</div></td>
                 <td class="bgtd"><div class="tddiv">2日内取消数</div></td>
                 <td class="bgtd"><div class="tddiv">3-7天内取消数</div></td>
                 <td class="bgtd"><div class="tddiv">7天以上取消数</div></td>
                 <td class="bgtd"><div class="tddiv blurth">降价原因取消数</div></td>
                 <td class="bgtd"><div class="tddiv">我司原因取消数</div></td>
                 <td class="bgtd"><div class="tddiv">其它原因取消数</div></td>
             </tr>
             <tr>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelAll}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelToDay}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelTwoDay}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelWeek}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelThanWeek}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelByPriceReduction}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelByWeCompanyReason}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.cancelByOtherReason}}</div></td>
             </tr>
             <tr>
                 <td class="bgtd"><div class="tddiv">总付款数</div></td>
                 <td class="bgtd"><div class="tddiv">履约付款数</div></td>
                 <td class="bgtd"><div class="tddiv">超1天付款数</div></td>
                 <td class="bgtd"><div class="tddiv">超2天付款数</div></td>
                 <td class="bgtd"><div class="tddiv">超3天付款数</div></td>
                 <td class="bgtd"><div class="tddiv">未付款数</div></td>
                 <td class="bgtd"><div class="tddiv">--</div></td>
                 <td class="bgtd"><div class="tddiv">--</div></td>
             </tr>
             <tr>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.payAll}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.payToDay}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.payOneDay}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.payTwoDay}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.payThreeDay}}</div></td>
                 <td><div class="tddiv">{{orderInfo.orderStatistics.payNo}}</div></td>
                 <td><div class="tddiv">--</div></td>
                 <td><div class="tddiv">--</div></td>
             </tr>
         </table>

      <div style="margin-top: 20px">
        <svg-icon icon-class="marker" style="color: #606266"></svg-icon>
        <span class="font-small">商品信息</span>
          <span style="color:red;padding-left:10px;font-size:12px">摩叔运费（调整）：{{ orderInfo.orderGoodsData | fiFreight}}</span>
          <span style="padding-left:10px;font-size:12px">摩叔运费：{{orderInfo.moresuFreight}}</span>
        <span style="margin-left:10px;color:red;font-size:16px;font-weight:bold;display: inline-block;border:1px solid red;padding:5px;" v-if="orderInfo.orderRemark && orderInfo.orderRemark.indexOf('货到付款')!= -1">注意：此合同申请货到付款!!!<span style="padding-left:10px">{{orderInfo.orderRemark}}</span></span>
        <span style="margin-left:10px;color:red;font-size:16px;font-weight:bold;display: inline-block;border:1px solid red;padding:5px;" v-else-if="orderInfo.orderRemark && orderInfo.orderRemark.indexOf('预付定金')!= -1">注意：此合同申请定金!!!<span style="padding-left:10px">{{orderInfo.orderRemark}}</span></span>
        <span style="margin-left:10px;color:red;font-size:16px;font-weight:bold;display: inline-block;border:1px solid red;padding:5px;" v-else><span style="padding-left:10px">{{orderInfo.orderRemark}}</span></span>
      </div>

       <el-form size="small" :model="orderInfo" ref="orderInfo" :rules="rules" style="overflow: hidden">
          <el-table
                 ref="orderItemTable"
                 :data="orderInfo.orderGoodsData"
                 style="width: 100%;margin-top: 20px" border>
           <el-table-column label="商品名称" fixed>
             <template slot-scope="scope">
               {{scope.row.goodsName}}
             </template>
           </el-table-column>
          <el-table-column label="单价" width="160" align="center">
              <template slot-scope="scope">
                  <div style="padding:0px 0 5px 0 ">
                      <div style="font-weight: bold;line-height: 16px">￥{{scope.row.moresuPrice}}</div>
                      <div>{{scope.row.moresuWarehouse}}</div>
                  </div>
                  <div style="color:red;border-top:1px solid #eee;line-height: 16px; padding:5px 0 0 0">
                      <div style="font-weight: bold">￥{{scope.row.goodsPrice}}</div>
                      <div>合同单价</div>
                  </div>
              </template>
          </el-table-column>
            <el-table-column label="结算方式"  width="150" align="center">
              <template slot-scope="scope">
                {{scope.row.ospPayMethod}}
              </template>
            </el-table-column>
<!--          <el-table-column label="更新价格" width="160">-->
<!--              <template slot-scope="scope">-->
<!--                  <el-form-item v-if="(orderInfo.orderState == 25 || orderInfo.orderState == 20) && orderInfo.isNeedMyCheck" :prop="`orderGoodsData.${scope.$index}.changePrice`" :rules="rules.changePrice" >-->
<!--                      <el-input v-model="scope.row.changePrice" size="mini" ></el-input>-->
<!--                      <div style="margin-top:5px;">-->
<!--                          <el-checkbox  style="margin-top:5px" v-model="scope.row.isChangePrice">不更新</el-checkbox>-->
<!--                      </div>-->
<!--                  </el-form-item>-->
<!--                  <div v-else>-->
<!--                      {{scope.row.changePrice}} <span style="padding-left:10px">{{scope.row.isChangePrice == 1 ? '已更新' : '没更新'}}</span>-->
<!--                  </div>-->
<!--              </template>-->
<!--          </el-table-column>-->
           <el-table-column label="合同数量"  width="100"  align="center">
             <template slot-scope="scope">
                 {{scope.row.goodsNum}}{{scope.row.goodsUnit}}
             </template>
           </el-table-column>
              <el-table-column label="已发货数量"
                               width="100"  align="center">
                  <template slot-scope="scope">
                      {{scope.row.sendNum}}{{scope.row.goodsUnit}}
                  </template>
              </el-table-column>
           <el-table-column label="合同金额"   width="100" align="center">
             <template slot-scope="scope">
                 ￥{{scope.row.goodsAmount}}
             </template>
           </el-table-column>
          <el-table-column label="杂费(装卸费)" width="80" align="center">
              <template slot-scope="scope">
                  <div>{{scope.row.consultation }}</div>
              </template>
          </el-table-column>

           <el-table-column label="价格类型" width="100" align="center">
             <template slot-scope="scope">
                 <el-form-item :prop="`orderGoodsData.${scope.$index}.priceType`" :rules="rules.priceType" v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">
                 <el-select class="input-width" placeholder="请选择" clearable style="width:100%" v-model="scope.row.priceType">
                     <el-option :key="item" :label="item"  :value="item" v-for="item in priceTypes"></el-option>
                 </el-select>
               </el-form-item>
                 <div v-else>{{scope.row.priceType}}</div>
             </template>
           </el-table-column>
            <el-table-column label="预估采购吨毛利" width="120" align="center" key="21">
              <template slot-scope="scope">
                <span :style="{'color':scope.row.purchaseProfit <0 ? 'red' :'#606266'}">{{scope.row.purchaseProfit}}</span>
              </template>
            </el-table-column>
          <el-table-column label="预估底价" width="100" align="center">
              <template slot-scope="scope">
                  <el-form-item :prop="`orderGoodsData.${scope.$index}.purchasePrice`" :rules="rules.purchasePrice" v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">
                      <el-input v-model="scope.row.purchasePrice"></el-input>
                  </el-form-item>
                  <div v-else>{{scope.row.purchasePrice}}</div>
              </template>
          </el-table-column>

            <el-table-column label="采购价格" width="200" >
              <template slot-scope="scope">
                <el-form-item label="预估" :prop="`orderGoodsData.${scope.$index}.predictPrice`" :rules="rules.predictPrice" v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">
                  <el-input v-model="scope.row.predictPrice" style="width:120px;"></el-input>
                </el-form-item>
                <el-form-item label="实际" :prop="`orderGoodsData.${scope.$index}.actualPrice`" :rules="rules.actualPrice" v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">
                  <el-input v-model="scope.row.actualPrice" style="width:120px;"></el-input>
                </el-form-item>
                <div v-else>
                    <div>预估：{{scope.row.predictPrice}}</div>
                    <div>实际：{{scope.row.actualPrice}}</div>
                </div>
              </template>
            </el-table-column>

              <el-table-column label="实际底价" width="100" align="center">
                  <template slot-scope="scope">
<!--                        <el-form-item :prop="`orderGoodsData.${scope.$index}.purchaseActualPrice`" :rules="rules.purchaseActualPrice" v-if="orderInfo.orderState==40">-->
<!--                            <el-input v-model="scope.row.purchaseActualPrice"></el-input>-->
<!--                        </el-form-item>-->
                      <div>{{scope.row.purchaseActualPrice}}</div>
                  </template>
              </el-table-column>
              <el-table-column label="预估毛利" width="80" align="center">
                  <template slot-scope="scope">
                      <span v-if="orderInfo.orderState == 20" style="color:Red">
                          {{scope.row.goodsPrice | fifterPrice(scope.row.purchasePrice,scope.row.consultation,scope.row.goodsNum,scope.row.inputFreight,scope.row.freightType)}}
                      </span>
                      <span v-else style="color:Red">
                          {{scope.row.goodsPrice | fifterPrice(scope.row.purchasePrice,scope.row.consultation,scope.row.goodsNum,scope.row.inputFreight,scope.row.freightType)}}
                      </span>
<!--                      <span style="color:Red">{{scope.row.saleProfit}}</span>-->
                  </template>
              </el-table-column>

            <!--<el-table-column label="公司预估毛利" width="80" align="center">
              <template slot-scope="scope">
                     {{scope.row | fifpredictPrice('predictPrice')}}
              </template>
            </el-table-column>

            <el-table-column label="公司实际毛利" width="80" align="center">
              <template slot-scope="scope">
                {{scope.row | fifpredictPrice('actualPrice')}}
              </template>
            </el-table-column>-->

              <el-table-column label="吨毛利" width="80" align="center">
                  <template slot-scope="scope">
                      <span style="color:red">
                          {{scope.row.perSaleProfit}}
                      </span>
                  </template>
              </el-table-column>
              <el-table-column label="摩叔运费" width="120" align="center">
                  <template slot-scope="scope">
                      <div>{{scope.row.goodsFreight}}</div>
                  </template>
              </el-table-column>
              <el-table-column label="发货类型" width="120" align="center">
                  <template slot-scope="scope">
                      <el-form-item :prop="`orderGoodsData.${scope.$index}.sendType`" :rules="rules.sendType" v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">
                          <el-select class="input-width" style="width:100%" placeholder="请选择" clearable v-model="scope.row.sendType">
                              <el-option :key="item" :label="item"  :value="item" v-for="item in sendTypes"></el-option>
                          </el-select>
                      </el-form-item>
                      <div v-else>{{scope.row.sendType}}</div>
                  </template>
              </el-table-column>

              <el-table-column label="发货仓库" width="150" align="center">
                  <template slot-scope="scope">
                      <div v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">
                          <el-form-item :prop="`orderGoodsData.${scope.$index}.warehouseName`" :rules="rules.warehouseName" >
                              <el-select v-model="scope.row.warehouseName"  placeholder="请选择">
                                      <el-option
                                        v-for="item in wList"
                                        :key="item.warehouseId"
                                        :label="item.warehouseName"
                                        :value="item.warehouseName">
                                      </el-option>
<!--                                  <el-option value="江苏一号仓" label="江苏一号仓" key="江苏一号仓"></el-option>-->
<!--                                  <el-option value="工厂仓库" label="工厂仓库" key="工厂仓库"></el-option>-->
<!--                                  <el-option value="外仓" label="外仓" key="外仓"></el-option>-->
<!--                                  <el-option value="余达仓" label="余达仓" key="余达仓"></el-option>-->
<!--                                  <el-option value="塑通仓" label="塑通仓" key="塑通仓"></el-option>-->
                              </el-select>
                          </el-form-item>
                          <el-form-item v-if="scope.row.warehouseName.indexOf('外仓')!= -1" :prop="`orderGoodsData.${scope.$index}.warehouseNameRemark`" :rules="rules.warehouseNameRemark" >
                              <el-input v-model="scope.row.warehouseNameRemark"></el-input>
                          </el-form-item>
                      </div>
                      <div v-else>{{scope.row.warehouseName}}<span v-if="scope.row.warehouseNameRemark != ''"> - {{scope.row.warehouseNameRemark}}</span></div>
                  </template>
              </el-table-column>
              <el-table-column label="运联含税运费" width="150" align="center" label-class-name="blurth">
                  <template slot-scope="scope">
                      <el-form-item  v-if="(orderInfo.orderState == 20 && scope.row.sendType != '' && scope.row.sendType != '公司发货' && orderInfo.isCanInputFreight) || (orderInfo.orderState == 25 && orderInfo.isCanInputFreight)">
                          <el-input-number style="width:120px;" v-model="scope.row.inputFreight"  :controls="false" :precision="2" class="inputleft"></el-input-number>
                      </el-form-item>
                      <div v-else>{{scope.row.inputFreight}}</div>
                      <el-form-item  v-if="scope.row.remark.indexOf('自提') == -1 && orderInfo.orderState == 20 && orderInfo.isNeedMyCheck ">
                           <el-radio-group v-model="scope.row.freightType">
                               <el-radio label="sale" style="margin-right:0">销售承担运费</el-radio>
                               <el-radio label="purchase">采购承担运费</el-radio>
                           </el-radio-group>
                      </el-form-item>
                      <div v-else-if="scope.row.remark.indexOf('自提') == -1">{{scope.row.freightType | fifFreightType}}</div>
                  </template>
              </el-table-column>
              <el-table-column label="期望发货日期" width="120" align="center">
                  <template slot-scope="scope">
                      <span >{{scope.row.expectSendDate}}</span>
                  </template>
              </el-table-column>
              <el-table-column label="发货紧急度" width="100" align="center">
                  <template slot-scope="scope">
                      <div>{{scope.row.urgentTypeStr}}</div>
                      <div v-if="scope.row.urgentTypeStr == '必须'">{{scope.row.urgentRemark}}</div>
                  </template>
              </el-table-column>
              <el-table-column label="合同约定时间" width="120" align="center" label-class-name="blurth">
                  <template slot-scope="scope">
                      <span >{{scope.row.timeSureDate}}</span>
                  </template>
              </el-table-column>
           <el-table-column label="预计发货日期" width="270" align="center">
             <template slot-scope="scope">
                 <div v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">
                 <el-form-item style="display: inline-block" :prop="`orderGoodsData.${scope.$index}.sendDate1`" :rules="rules.sendDate1">
                     <el-date-picker
                             @change="isImit(scope.row,scope.row.sendDate1)"
                             v-model="scope.row.sendDate1"
                             value-format="yyyy-MM-dd"
                             style="width:140px"
                             type="date"
                             placeholder="发货日期">
                     </el-date-picker>
                 </el-form-item>
                 <el-form-item style="display: inline-block" :prop="`orderGoodsData.${scope.$index}.sendRate1`" :rules="rules.sendRate1">
                   <el-input placeholder="发货概率" style="width:70px"  v-model="scope.row.sendRate1"></el-input> %
                 </el-form-item>
                   <div></div>
               </div>
                 <div v-else>{{scope.row.sendDate1}}<span style="padding-left:10px">{{scope.row.sendRate1}}%</span></div>
<!--                 <div v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">-->
<!--                   <el-form-item style="display: inline-block" :prop="`orderGoodsData.${scope.$index}.sendDate2`" :rules="rules.sendDate2">-->
<!--                       <el-date-picker-->
<!--                               @change="isImit(scope.row,scope.row.sendDate2)"-->
<!--                               value-format="yyyy-MM-dd"-->
<!--                               v-model="scope.row.sendDate2"-->
<!--                               style="width:140px"-->
<!--                               type="date"-->
<!--                               placeholder="发货日期">-->
<!--                       </el-date-picker>-->
<!--                   </el-form-item>-->
<!--                   <el-form-item style="display: inline-block">-->
<!--                     <el-input placeholder="发货概率" style="width:70px" v-model="scope.row.sendRate2"></el-input> %-->
<!--                   </el-form-item>-->
<!--                 </div>-->
<!--                 <div v-else v-show="scope.row.sendDate2">{{scope.row.sendDate2}}<span style="padding-left:10px">{{scope.row.sendRate2}}%</span></div>-->
<!--                 <div v-if="orderInfo.orderState == 20 && orderInfo.isNeedMyCheck">-->
<!--                   <el-form-item style="display: inline-block" :prop="`orderGoodsData.${scope.$index}.sendDate3`" :rules="rules.sendDate3">-->
<!--                       <el-date-picker-->
<!--                               @change="isImit(scope.row,scope.row.sendDate3)"-->
<!--                               value-format="yyyy-MM-dd"-->
<!--                               v-model="scope.row.sendDate3"-->
<!--                               style="width:140px"-->
<!--                               type="date"-->
<!--                               placeholder="发货日期">-->
<!--                       </el-date-picker>-->
<!--                   </el-form-item>-->
<!--                   <el-form-item style="display: inline-block">-->
<!--                     <el-input placeholder="发货概率" style="width:70px" v-model="scope.row.sendRate3"></el-input> %-->
<!--                   </el-form-item>-->
<!--                 </div>-->
<!--                 <div v-else v-show="scope.row.sendDate3">{{scope.row.sendDate3}}<span style="padding-left:10px">{{scope.row.sendRate3}}%</span></div>-->
             </template>
           </el-table-column>

            <el-table-column width="150" label="采购完成发货时间" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.endSendDate }}</span>
              </template>
            </el-table-column>

           <el-table-column label="备注" width="80" fixed="right">
             <template slot-scope="scope">
                 {{scope.row.remark}}
             </template>
           </el-table-column>
         </el-table>
           <el-alert
                   style="margin-top:20px;"
                   :closable="false"
                   type="warning"
                   show-icon>
               <template slot="title">
                   <div style="color:#606266">特殊需求</div>
               </template>
               <template>
                   <div style="padding-bottom:10px;color:#606266;line-height: 22px">
                       <span style="padding-right:15px;white-space:nowrap;">是否工厂直发：<span style="font-weight: bold;font-size:14px;color:Red">{{orderInfo.isFactoryDeliver == 1 ? '是' : orderInfo.isFactoryDeliver == 2 ?'否' : '--'}}</span></span>
                       <span style="padding-right:15px;white-space:nowrap;">生产日期：<span style="font-weight: bold;font-size:14px;color:Red">{{orderInfo.productionDate != '' ? orderInfo.productionDate : '--'}}</span></span>
                       <span style="padding-right:15px;white-space:nowrap;">真空率：<span style="font-weight: bold;font-size:14px;color:Red">{{orderInfo.packingRequire != '' ? orderInfo.packingRequire : '--'}}</span> </span>
                       <span style="padding-right:15px;white-space:nowrap;">破包率：<span style="font-weight: bold;font-size:14px;color:Red">{{orderInfo.brokenRate != '' ? orderInfo.brokenRate : '--'}}</span> </span>
                       <span style="padding-right:15px;white-space:nowrap;">节假日是否收货：<span style="font-weight: bold;font-size:14px;color:Red">{{orderInfo.isHolidayCanSend == 2 ? '周六周日都不收货' : orderInfo.isHolidayCanSend == 3 ?'周日不收货' : '--'}}</span></span>
                       <span style="padding-right:15px;white-space:nowrap;">是否为同一批次产品：<span style="font-weight: bold;font-size:14px;color:Red">{{orderInfo.batchRequire != '' ? orderInfo.batchRequire : '--' }}</span></span>
                       <span style="padding-right:15px;white-space:nowrap;">备注：<span style="font-weight: bold;font-size:14px;color:Red">{{orderInfo.buyerRemark ? orderInfo.buyerRemark : '--' }}</span></span>
                   </div>
               </template>
           </el-alert>
          <div style="float: right;margin: 20px" class="price-block">
           <div style="display: inline-block;">
               <div class="lab">商品总额：</div><div class="text">￥{{orderInfo.orderGoodsAmount}}<span>(已优惠￥{{orderInfo.moresuCouponAmount}})</span></div></div>
              <div style="display: inline-block;">
                  <div class="lab" style="width:60px" v-if="orderInfo.sendType == '供方承担运输费用' && orderInfo.moresuFreight == 0">免运费</div>
                  <div class="lab" style="width:60px">运费：</div><div class="text">￥{{orderInfo.orderShippingFee}}</div>
              </div>
              <div style="display: inline-block;font-size:16px;font-weight: bold;color:red">
                  <div class="lab" style="width:60px">实付：</div><div class="text">￥{{orderInfo.orderPayAmount}}</div>
              </div>
              <div style="display: inline-block;">
                  <div class="lab" style="width:auto;padding-left:10px;">预估毛利:</div>
                  <div class="text">￥{{orderInfo.orderGoodsData | fifterAllSaleProfit(orderInfo.orderState)}}</div>
<!--                  <div class="text">￥{{orderInfo.saleProfit}}</div>-->
              </div>
<!--               <div style="display: inline-block;">-->
<!--                  <div class="lab" style="width:auto;padding-left:10px;">订单总额:</div>-->
<!--                  <div class="text">￥{{orderInfo.orderAmount}}</div>-->
<!--              </div>-->
         </div>
          <div style="float:left;width:40%;margin-top:20px" v-if="(orderInfo.orderState == 5 || orderInfo.orderState == 20 || orderInfo.orderState == 25 || orderInfo.orderState == 24) && orderInfo.isNeedMyCheck">
           <el-form-item label="请输入操作备注">
             <el-input :autosize="{ minRows: 2, maxRows: 6}" type="textarea" style="width:100%" v-model.trim="pumsRemark"></el-input>
           </el-form-item>
         </div>
       </el-form>

         <!---优惠券--->
         <div style="margin-top: 20px;clear: both" v-if="moresuCouponInfo.length > 0">
             <svg-icon icon-class="marker" style="color: #606266"></svg-icon>
             <span class="font-small">优惠券信息</span>
         </div>

         <el-table
                 v-if="moresuCouponInfo.length > 0"
                 ref="orderItemTable"
                 :data="moresuCouponInfo"
                 style="width:auto;min-width:830px;margin-top: 20px" border>
             <el-table-column label="券号"  width="150" align="center">
                 <template slot-scope="scope">
                     {{scope.row.couponSn}}
                 </template>
             </el-table-column>
             <el-table-column label="券名称" width="180" align="center">
                 <template slot-scope="scope">
                     {{scope.row.couponName}}
                 </template>
             </el-table-column>
             <el-table-column label="优惠金额"   width="100"  align="center">
                 <template slot-scope="scope">
                     {{scope.row.couponAmount}}/吨
                 </template>
             </el-table-column>
             <el-table-column label="起订量"   width="100" align="center">
                 <template slot-scope="scope">
                     {{scope.row.limitWeight}}
                 </template>
             </el-table-column>
             <el-table-column label="有效期" width="250" align="center">
                 <template slot-scope="scope">
                     {{scope.row.startTime}} - {{scope.row.endTime}}
                 </template>
             </el-table-column>
             <el-table-column label="状态" width="100" align="center">
                 <template slot-scope="scope">
                     已使用
                 </template>
             </el-table-column>
         </el-table>

     <div style="margin-top: 20px;clear: both">
         <svg-icon icon-class="marker" style="color: #606266"></svg-icon>
         <span class="font-small">发货信息</span>
     </div>
     <el-form :model="deliverForm" ref="deliverForm" :rules="rules4">
        <el-table
                ref="orderItemTable"
                :data="deliverForm.dgList"
                style="width: 100%;margin-top: 20px" border>
            <el-table-column label="类型"  width="100" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}"> {{scope.row.deliverType}}</span>
                </template>
            </el-table-column>
            <el-table-column label="发货单号" width="160" align="center">
                <template slot-scope="scope">
                    <el-link type="primary" style="font-size:12px;vertical-align: middle" @click="toDeliverCon(scope.row)">
                    {{scope.row.deliverSn}}
                    </el-link>
                    <img src="../../assets/images/zhuofei2.png" v-if="scope.row.isDelete == 1" style="vertical-align: middle;"/>
                </template>
            </el-table-column>
          <el-table-column label="开票状态"  width="100" align="center">
            <template slot-scope="scope">
              {{scope.row.invoiceState}}
            </template>
          </el-table-column>
            <el-table-column label="发货时间"   width="100"  align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.shipTime}}</span>
                </template>
            </el-table-column>
            <el-table-column label="商品牌号"   width="200" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.goodsSn}}</span>
                </template>
            </el-table-column>
            <el-table-column label="发货数量" width="100" align="center">
                <template slot-scope="scope">
                    <div :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.shipNum }}</div>
                </template>
            </el-table-column>

            <el-table-column label="发货批号" width="150" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.batchNo }}</span>
                </template>
            </el-table-column>
          <el-table-column label="采购结算方式" width="150" align="center">
            <template slot-scope="scope">
              <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.goodsPayMethod }}</span>
            </template>
          </el-table-column>
            <el-table-column label="合同单价" width="100" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.goodsPrice }}</span>
                </template>
            </el-table-column>
            <el-table-column label="采购底价" width="150" align="center">
                <template slot-scope="scope">
                    <el-form-item :prop="`dgList.${scope.$index}.purchaseRealPrice`" :rules="rules4.purchaseRealPrice" v-if="(orderInfo.orderState == 40 &&  scope.row.isDelete != 1 && changeRealPrice)">
                        <el-input v-model="scope.row.purchaseRealPrice" size="small"></el-input>
                    </el-form-item>
                    <div v-else>{{scope.row.purchaseRealPrice}}</div>
                </template>
            </el-table-column>
            <el-table-column label="实际含税运费" width="100" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.goodsFreight}}</span>
                </template>
            </el-table-column>
            <el-table-column label="运费承担" width="100" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.freightType}}</span>
                </template>
            </el-table-column>
            <el-table-column label="杂费(装卸费)" width="100" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}"> {{scope.row.consultation}}</span>
                </template>
            </el-table-column>
            <el-table-column label="实际现金毛利" width="100" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}"> {{scope.row.saleProfit}}</span>
                </template>
            </el-table-column>
            <el-table-column label="销售发货毛利" width="100" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.goodsPrice | fifterPriceType(scope.row.purchaseRealPrice,scope.row.consultation,scope.row.shipNum,scope.row.goodsFreight,scope.row.freightType,scope.row.deliverType)}}</span>
                    <!--{{scope.row.saleSendProfit}}-->
                </template>
            </el-table-column>
            <el-table-column label="销售发货吨毛利" width="120" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.goodsPrice | fifterPriceTypeDun(scope.row.purchaseRealPrice,scope.row.consultation,scope.row.shipNum,scope.row.goodsFreight,scope.row.freightType,scope.row.deliverType)}}</span>
                   <!--{{scope.row.perSendProfit}}-->
                </template>
            </el-table-column>
            <el-table-column label="合同分类" width="80" align="center">
                <template slot-scope="scope">
                  <span :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}"> {{scope.row.orderType == 'normal' ? '正常' : '待定'}}</span>
                </template>
            </el-table-column>
            <el-table-column label="状态" width="120" align="center">
                <template slot-scope="scope">
                    <div :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.shipState}}</div>
                </template>
            </el-table-column>
            <el-table-column label="司机姓名" width="120" align="center" fixed="right">
                <template slot-scope="scope">
                    <div :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.driverName}}</div>
                </template>
            </el-table-column>
            <el-table-column label="司机电话" width="120" align="center" fixed="right">
                <template slot-scope="scope">
                    <div :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.driverPhone}}</div>
                </template>
            </el-table-column>
            <el-table-column label="车牌号" width="120" align="center" fixed="right">
                <template slot-scope="scope">
                    <div :style="{color:scope.row.deliverType == '退货单' ? 'red' : '#606266'}">{{scope.row.driverCardNo}}</div>
                </template>
            </el-table-column>
        </el-table>
        <div style="float:left;width:40%;margin-top:20px" v-if="orderInfo.orderState == 40 && changeRealPrice">
            <el-form-item label="请输入修改底价操作备注" prop="remark">
                <el-input :autosize="{ minRows: 2, maxRows: 6}" type="textarea" style="width:100%" v-model.trim="deliverForm.remark"></el-input>
            </el-form-item>
        </div>
    </el-form>

        <div style="text-align: center;clear: both;margin-top:20px" v-if="!seeType">
            <el-button type="primary" @click="handleConfirm" :loading="btnLoading" v-if="(orderInfo.orderState == 5 || orderInfo.orderState == 20 || orderInfo.orderState == 24 || orderInfo.orderState == 25)&& orderInfo.isNeedMyCheck">确认提交</el-button>
          <el-button type="primary" @click="cancelOrderClick"
                     v-if="orderInfo.isNeedMyCheck && ( orderInfo.orderState == -28 || orderInfo.orderState == -26 )">
            确认取消合同
          </el-button>
<!--            <el-button type="primary" @click="handleConfirm2" :loading="btnLoading" v-if="orderInfo.orderState == 40 && changeRealPrice">修改底价</el-button>-->
            <el-button type="primary" @click="handleConfirm2('deliverRecheck')" :loading="btnLoading4" v-if="orderInfo.orderState == 40 && changeRealPrice && isNeedRecheck">复核</el-button>
            <el-button type="primary" @click="examineZj" :loading="btnLoadingZj" v-if="orderInfo.orderState == 26 && orderInfo.isNeedMyCheck">采购总监审核</el-button>
<!--            <el-button type="primary" @click="showDialogRemark">添加备注</el-button>-->
            <el-button type="primary"  @click="toPrint(2)" v-if="orderInfo.orderState != 10 && orderInfo.isMy == 1">合同预览</el-button>
            <el-button type="primary" @click="toPrint(3)" v-if="orderInfo.unFinishedSend == 1 && orderInfo.isMy == 1">变更合同预览</el-button>
            <el-button @click="blackOrder" :loading="btnLoading1" v-if="(orderInfo.orderState == 5 || orderInfo.orderState == 20 || orderInfo.orderState == 25 || orderInfo.orderState == 24 )&& orderInfo.isNeedMyCheck">回 退</el-button>
        </div>


         <div style="margin-top: 20px;clear: both">
             <el-menu :default-active="logTab" class="el-menu-demo" mode="horizontal" @select="handleSelectLog">
                 <el-menu-item index="1">操作记录</el-menu-item>
                 <el-menu-item index="2">变更记录</el-menu-item>
                 <el-menu-item index="3">订单备注<span v-if="orderInfo.orderLogs">（{{orderInfo.orderLogs.orderLogByC.length}}）</span></el-menu-item>
                 <el-menu-item index="4">收款信息</el-menu-item>
<!--                 <el-menu-item index="5">发货信息</el-menu-item>-->
                 <el-menu-item index="6">司机信息</el-menu-item>
                 <el-menu-item index="7" v-if="orderInfo.orderState > 30">上传合同回单</el-menu-item>
                 <el-menu-item index="8">发货延迟原因（{{fhycList.length}}）</el-menu-item>
               <el-menu-item index="9">补充协议</el-menu-item>
             </el-menu>
         </div>

         <div style="margin-top:20px;border:1px solid #EBEEF5;padding:20px 20px 0 20px">
             <div v-if="logTab == 1 || logTab == 2 || logTab == 3">
                 <el-timeline>
                     <el-timeline-item
                             v-for="(activity, index) in orderLogs"
                             :key="index">
                         <span :style="{'color':activity.log_type == 1 ? 'red' : '#303133'}">
                             <span style="padding-right:10px;">{{activity.created_at}}</span>
                             {{activity.user_name}}：{{activity.content}}
                             <span v-show="activity.remark && activity.remark != ''" style="color:red;padding-left:5px">备注：{{activity.remark}}</span>
<!--                              <span v-show="logTab == 1" style="padding-left:5px">耗时：{{activity.time_consuming}}</span>-->
                         </span>

                     </el-timeline-item>
                 </el-timeline>
                 <div style="color:#888;padding:20px;text-align: center;font-size:12px" v-if="orderLogs.length == 0">- 暂无数据 -</div>
             </div>

             <div v-else-if="logTab == 4" style="padding-bottom:20px;">
                 <el-table
                         ref="orderItemTable"
                         :data="orderInfo.orderPayList"
                         style="width: 100%;margin-top: 20px" border>
                     <el-table-column label="收款日期" align="center">
                         <template slot-scope="scope">
                             {{scope.row.payTime}}
                         </template>
                     </el-table-column>
                     <el-table-column label="收款方式" align="center">
                         <template slot-scope="scope">
                             {{scope.row.payType}}
                         </template>
                     </el-table-column>
                     <el-table-column label="收款人" align="center">
                         <template slot-scope="scope">
                             {{scope.row.operator}}
                         </template>
                     </el-table-column>
                     <el-table-column label="收款金额" align="center">
                         <template slot-scope="scope">
                             {{scope.row.payAmount}}
                         </template>
                     </el-table-column>
                     <el-table-column label="收款凭证" align="center">
                         <template slot-scope="scope">
                             <img :src="scope.row.payContent" v-if="scope.row.payContent" @click="fullImg(scope.row.payContent)" style="width:50px;height:50px;object-fit: contain"/>
                         </template>
                     </el-table-column>
                     <el-table-column label="收款备注" align="center">
                         <template slot-scope="scope">
                             {{scope.row.remark}}
                         </template>
                     </el-table-column>
                     <el-table-column label="操作" align="center" v-if="$route.query.seeType=='caiWu'">
                       <template slot-scope="scope">
                         <el-button type="text" v-if="scope.row.payContent == ''" @click="showPz(scope.row)">上传凭证</el-button>
                       </template>
                     </el-table-column>
                 </el-table>
             </div>
             <div v-else-if="logTab == 5" style="padding-bottom:20px;">
                 <el-table
                         ref="orderItemTable"
                         :data="orderInfo.orderDeliverList"
                         style="width: 100%;margin-top: 20px" border>
                     <el-table-column label="发货单" align="center">
                         <template slot-scope="scope">
                             <span @click="toDeliverCon(scope.row)" style="color:#409EFF;cursor: pointer;vertical-align: middle">
                                  {{scope.row.deliverSn}}
                             </span>
                             <img src="../../assets/images/zhuofei2.png"  style="vertical-align: middle;" v-if="scope.row.isDelete"/>
                             <img src="../../assets/images/bian.png" v-if="scope.row.isUpdate" style="vertical-align: middle;"/>
                         </template>
                     </el-table-column>
                     <el-table-column label="发货日期" align="center">
                         <template slot-scope="scope">
                             {{scope.row.shipTime}}
                         </template>
                     </el-table-column>
                     <el-table-column label="发货数量" align="center">
                         <template slot-scope="scope">
                            {{scope.row.shipNum}}
                         </template>
                     </el-table-column>
                 </el-table>
             </div>
             <div v-else-if="logTab == 6" style="padding-bottom:20px;">
                 <el-table
                         ref="orderItemTable"
                         :data="orderInfo.orderDriverList"
                         style="width: 100%;margin-top: 20px" border>
                     <el-table-column label="司机姓名" align="center">
                         <template slot-scope="scope">
                             {{scope.row.driverName}}
                         </template>
                     </el-table-column>
                     <el-table-column label="手机号" align="center">
                         <template slot-scope="scope">
                             {{scope.row.driverMobile}}
                         </template>
                     </el-table-column>
                     <el-table-column label="提货数量" align="center">
                         <template slot-scope="scope">
                             {{scope.row.deliveryNum}}
                         </template>
                     </el-table-column>
                     <el-table-column label="提货日期" align="center">
                         <template slot-scope="scope">
                             {{scope.row.deliveryTime}}
                         </template>
                     </el-table-column>
                     <el-table-column label="车牌号" align="center">
                         <template slot-scope="scope">
                             {{scope.row.driverCardNo}}
                         </template>
                     </el-table-column>
                     <el-table-column label="备注" align="center">
                         <template slot-scope="scope">
                             {{scope.row.deliveryRemark}}
                         </template>
                     </el-table-column>
                 </el-table>
             </div>
             <div v-else-if="logTab == 7" style="padding-bottom:20px;">
                 <a target="_blank" :href="orderInfo.contractUrl" v-if="orderInfo.contractUrl && orderInfo.contractUrl != '' && (orderInfo.contractFiles.extension!='png' && orderInfo.contractFiles.extension!='jpg' && orderInfo.contractFiles.extension!='jpeg')" style="font-size:12px;color:#409EFF;display: block">
                     <i class="el-icon-notebook-2" style="padding-right:5px"></i>{{orderInfo.contractUrl}}
                 </a>
                 <div style="font-size:12px;color:#888;padding-top:10px">这是一个{{orderInfo.contractFiles.extension}}文件，如下载后无法打开请加上.{{orderInfo.contractFiles.extension}}</div>
                 <img :src="orderInfo.contractUrl"  v-if="orderInfo.contractUrl && orderInfo.contractUrl != '' && (orderInfo.contractFiles.extension=='png' || orderInfo.contractFiles.extension=='jpg' || orderInfo.contractFiles.extension=='jpeg')" style="width:100px;height:100px;object-fit: contain;cursor: pointer" @click="fullImg(orderInfo.contractUrl)" />
             </div>

             <div v-if="logTab == 8">
               <el-timeline>
                 <el-timeline-item
                   v-for="(activity, index) in fhycList"
                   :key="index">
                           <span>
                               <span style="padding-right:10px;">{{activity.logTime}}</span>
                               {{activity.logUser}}：{{activity.logContent}}
                           </span>
                 </el-timeline-item>
               </el-timeline>
               <div style="color:#888;padding:20px;text-align: center;font-size:12px" v-if="fhycList.length == 0">- 暂无数据 -</div>
             </div>

           <div v-if="logTab == 9">
             <el-link type="primary"
                      v-if="orderInfo.sideAgreementUrl != ''"
                      style="font-size:12px;padding-bottom: 20px" :href="orderInfo.sideAgreementUrl" target="_blank">
               {{orderInfo.sideAgreementUrl}}
             </el-link>
           </div>

         </div>
    </el-card>

      <!--调整采购底价-->
      <el-dialog
              :close-on-click-modal="false"
              title="调整采购底价"
              :beforeClose="handleClose2"
              :visible.sync="dialogVisible"
              width="600px">
          <el-form :model="goodsForm" size="mini" label-width="100px" :rules="rules2" ref="goodsForm">
              <el-form-item label="实际底价：" prop="purchaseActualPrice">
                  <el-input v-model="goodsForm.purchaseActualPrice" style="width:150px"></el-input>
              </el-form-item>
              <el-form-item label="预计利润：">
                  {{curGoods.goodsPrice | fifterPrice(goodsForm.purchaseActualPrice,curGoods.consultation,curGoods.goodsNum,curGoods.inputFreight) }}
              </el-form-item>
              <el-form-item label="调整原因：" prop="remark">
                  <el-input v-model="goodsForm.remark" :autosize="{ minRows: 2, maxRows: 6}" type="textarea"></el-input>
              </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
          <el-button @click="handleClose2">取 消</el-button>
          <el-button type="primary" @click="handleConfirm2" :loading="btnLoading2">确 定</el-button>
      </span>
      </el-dialog>

      <!--备注-->
      <el-dialog
              :close-on-click-modal="false"
              :beforeClose="handleClose3"
              title="填写备注"
              :visible.sync="dialogVisible3"
              width="400px">
          <el-form :model="remarkForm" size="mini" label-width="100px"  ref="remarkForm" :rules="rules3">
              <el-form-item label="备注类型：" prop="remarkTypeStr">
              <el-select v-model.number="remarkForm.remarkTypeStr" class="input-width" style="width:195px" placeholder="请选择">
                  <el-option :value="item.cddValue" :label="item.cddValue" :key="item.cddValue" v-for="item in remarkList"></el-option>
              </el-select>
              </el-form-item>
              <el-form-item label="调整原因：" prop="remark">
                  <el-input v-model="remarkForm.remark" :autosize="{ minRows: 2, maxRows: 6}" type="textarea"></el-input>
              </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
          <el-button @click="handleClose3">取 消</el-button>
          <el-button type="primary" @click="handleConfirm3" :loading="btnLoading3">确 定</el-button>
      </span>
      </el-dialog>

      <!--放大图片-->
      <el-dialog
              :visible.sync="dialogVisible4"
              width="800px">
          <img :src="fullSrc" style="width:100%;"/>
      </el-dialog>

      <!---价格更新详细-->
      <el-dialog
              title="价格更新详情"
              :visible.sync="showPriceChange"
              width="900px">
          <el-table :data = "changePriceList">
              <el-table-column label="商品名称"  align="center" width="250">
                  <template slot-scope="scope">{{scope.row.goodsName}}</template>
              </el-table-column>
              <el-table-column label="仓库"  align="center" width="180">
                  <template slot-scope="scope">{{scope.row.warehouseName}}</template>
              </el-table-column>
              <el-table-column label="价格" header-align="center">
                  <template slot-scope="scope">
                      <div v-for="(item,index) in scope.row.priceList" style="display: inline-block;text-align: center;width:33%">
                          <div v-if="scope.row.priceList.length == 1 ">
                              <div>￥<span style="font-size:16px;color:Red">{{item.goodsPrice}}</span></div>
                              <div>起订量 ≥{{item.beginNum*1 }} 吨 </div>
                          </div>
                          <div v-else-if="index == 0 ">
                              <div>￥<span style="font-size:16px;color:Red">{{item.goodsPrice}}</span></div>
                              <div>起订量 {{item['beginNum']*1 }}至{{item['endNum']*1}} 吨以下</div>
                          </div>
                          <div v-else-if="scope.row.priceList[index+1]">
                              <div>￥<span style="font-size:16px;color:Red">{{item.goodsPrice}}</span></div>
                              <div>起订量 {{item['beginNum']*1 }} - {{item['endNum']*1}} 吨</div>
                          </div>
                          <div v-else>
                              <div>￥<span style="font-size:16px;color:Red">{{item.goodsPrice}}</span></div>
                              <div>起订量 ≥{{item['beginNum']*1 }}吨</div>
                          </div>
                      </div>
                  </template>
              </el-table-column>
          </el-table>
      </el-dialog>


    <!--采购总监审核-->
    <el-dialog
      :close-on-click-modal="false"
      title="采购总监审核"
      :visible.sync="dialogVisibleZj"
      width="400px">
      <el-form size="mini" label-width="100px"  ref="zjForm" >
        <el-form-item label="备注：" >
          <el-input v-model="remarkZj" :autosize="{ minRows: 2, maxRows: 6}" type="textarea" placeholder="拒绝必填"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
          <el-button @click="handleConfirmZj(2)" :loading="btnLoadingZj2">拒 绝</el-button>
          <el-button type="primary" @click="handleConfirmZj(1)" :loading="btnLoadingZj">同 意</el-button>
      </span>
    </el-dialog>


    <!--上传财务收款凭证-->
    <el-dialog
      :close-on-click-modal="false"
      title="上传收款凭证"
      :visible.sync="dialogVisiblePz"
      width="400px">
      <el-form  size="mini" label-width="80px">
        <el-form-item label="凭证：" >
          <div style="width: 100%;height: 150px; border:1px solid #DCDFE6;cursor: default;border-radius: 4px;">
            <img id="imgNode" :src="payContent" style="width:100%;height:100%;object-fit: contain;border:0" v-show="payContent">
            <el-input type="hidden" v-model="payContent"></el-input>
          </div>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisiblePz = false" >取 消</el-button>
          <el-button type="primary" @click="handleConfirmPz">确 定</el-button>
      </span>
    </el-dialog>

    <!--取消合同确认/拒绝-->
    <cancelClick ref="cancelClick" @update="cancelUpdate"></cancelClick>

  </div>
</template>

<script>
    import { mapGetters } from 'vuex'
    import {formatDate} from '@/utils/date';
    import store from '@/store'
    import {setPayReceipt,getCustomerSetting, getOrdersShow,postOrdersprocess,ordersGoodsConfig,ordersRemark,searchLimit,getSyncOneOrder,ordDeliverGoods,editPurchaseRealPrice,moresuGoodsPrice,delayReasonList,uploadBase64,getQiniuToken} from '@/api/partner'
    import {validateCommission} from '@/utils/validate';
    import {showtime} from '@/utils/index'
    import {getWarehouseList} from '@/api/order'
    import cancelClick from '@/views/components/cancelClick'
    import cancelOrder from "../sale/components/cancelOrder";
    import crmTag from "@/views/components/crmTag";
    export default {
        name: "customerDetail",
        data(){
            const isvalidateCommission = (rule, value, callback) => {
                if (!validateCommission(parseFloat(value))) {
                    callback(new Error('非负整数或小数'))
                } else if(value > 99999999){
                    callback(new Error('最大值为99999999'))
                }else {
                    callback()
                }
            };
            const isSendRate1 = (rule, value, callback)=>{
                if (value <= 0) {
                    callback(new Error('大于零的值'))
                }else {
                    callback()
                }
            };
            const isvalidateSendDate1 = (rule, value, callback)=> {
                let indexArray = rule.field.split(".");
                let i = indexArray[1];
                let sendDate = new Date(value);
                let expectSendDate = new Date(this.orderInfo.orderGoodsData[i].expectSendDate);
                let urgentTypeStr = this.orderInfo.orderGoodsData[i].urgentTypeStr;
                let dateSpan = sendDate - expectSendDate;
                let iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
                if (!value) {
                    callback(new Error('请输入发货日期'))
                }else if((urgentTypeStr == '必须' || urgentTypeStr == '等客户通知')  && (sendDate  > expectSendDate)){
                    callback(new Error('发货时间超出期望发货时间'))
                }else if(urgentTypeStr == '可延1-2天' && iDays > 2){
                    callback(new Error('发货时间超出期望发货时间'))
                } else if(urgentTypeStr == '可延1-2周' && iDays > 14){
                    callback(new Error('发货时间超出期望发货时间'))
                }else{
                    callback()
                }
            };
            const isvalidateSendDate2 = (rule, value, callback)=> {
                let indexArray = rule.field.split(".");
                let i = indexArray[1];
                let sendDate = new Date(value);
                let expectSendDate = new Date(this.orderInfo.orderGoodsData[i].expectSendDate);
                let urgentTypeStr = this.orderInfo.orderGoodsData[i].urgentTypeStr;
                let dateSpan = sendDate - expectSendDate;
                let iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
                if((urgentTypeStr == '必须' || urgentTypeStr == '等客户通知')  && (sendDate  > expectSendDate)){
                    callback(new Error('发货时间超出期望发货时间'))
                }else if(urgentTypeStr == '可延1-2天' && iDays > 2){
                    callback(new Error('发货时间超出期望发货时间'))
                } else if(urgentTypeStr == '可延1-2周' && iDays > 14){
                    callback(new Error('发货时间超出期望发货时间'))
                }else{
                    callback()
                }
            };
            const isvalidatePurchaseRealPrice = (rule, value, callback)=> {
                let indexArray = rule.field.split(".");
                console.log("rule",rule)
                let i = indexArray[1];
                let num = value - parseFloat(this.deliverForm.dgList[i]['goodsPrice']);
                if (!validateCommission(parseFloat(value))) {
                    callback(new Error('非负整数或小数'))
                }else {
                    callback()
                }
            };
          const isvalidatePredictPrice = (rule, value, callback)=> {
            let indexArray = rule.field.split(".");
            let i = indexArray[1];
            let predictPrice = this.orderInfo.orderGoodsData[i].predictPrice;
            let actualPrice = this.orderInfo.orderGoodsData[i].actualPrice
            if (parseFloat(value) === 0) {
              callback(new Error('不可以为零'))
            }else if (predictPrice == '' && actualPrice == '') {
              callback(new Error('二个必须填写一个'))
            }else if (predictPrice != '' && actualPrice != '') {
              callback(new Error('二个不可以都填'))
            }else {
              callback()
            }
          };
            return{
                roles:store.getters.roles ? store.getters.roles : [],
                loading:false,
                tableData:[],
                orderId:this.$route.query.id,
                type:this.$route.query.type,
                seeType:this.$route.query.seeType,
                orderInfo:{},
                customerIndustryList: [],
                btnLoading:false,
                pumsRemark:'',
                btnLoading1:false,
                sendTypes:[],
                priceTypes:[],
                rules:{
                    priceType:[{required: true, trigger: 'change' ,message: '请选择价格类型',}],
                    purchaseActualPrice:[{required: true, trigger: 'blur' ,validator: isvalidateCommission}],
                    purchasePrice:[{required: true, trigger: 'blur' ,validator: isvalidateCommission}],
                    sendType:[{required: true, trigger: 'change' ,message: '请选择发货类型',}],
                    warehouseName:[{required: true, trigger: 'blur' ,message: '请输入发货仓库',}],
                    sendDate1:[{required: true, trigger: 'change' ,validator: isvalidateSendDate1}],
                    sendRate1:[{required: true, trigger: 'blur' ,validator: isSendRate1,}],
                    // sendDate2:[{required: true, trigger: 'change' ,validator: isvalidateSendDate2}],
                    // sendDate3:[{required: true, trigger: 'change' ,validator: isvalidateSendDate2}],
                    priceRemark:[{required: true, trigger: 'blur' ,message: '请输入调整原因',}],
                    // changePrice:[{required: true, trigger: 'blur' ,validator: isvalidateCommission}],
                    warehouseNameRemark:[{required: true, trigger: 'blur' ,message: '请输入备注原因'}],
                    predictPrice:[{required: true, trigger: 'blur' ,validator: isvalidatePredictPrice}],
                    actualPrice:[{required: true, trigger: 'blur' ,validator: isvalidatePredictPrice}]
                },
                rules5:{
                    customerLabel:[{required: true, trigger: 'change' ,message: '请输入采购评级',}],
                    isSpecialOrder:[{required: true, trigger: 'change' ,message: '请选择分类',}],
                },
                dialogVisible:false,
                btnLoading2:false,
                goodsForm:{
                    purchaseActualPrice:'',
                    remark:'',
                },
                curGoods:{},
                rules2:{
                    purchaseActualPrice:[{required: true, trigger: 'blur' ,validator: isvalidateCommission}],
                    remark:[{required: true, trigger: 'blur' ,message: '请输入调整原因',}],
                },
                logTab:'1',
                orderLogs:[],
                dialogVisible3:false,
                btnLoading3:false,
                remarkForm:{
                    remarkTypeStr:'',
                    remark:'',
                },
                rules3:{
                    remarkTypeStr:[{required: true, trigger: 'change' ,message: '请选择备注类型',}],
                    remark:[{required: true, trigger: 'blur' ,message: '请输入备注',}],
                },
                orderInfoSaleProfit:'',
                remarkList:[],
                fullSrc:'',
                dialogVisible4:false,
                btnLoading5:false,
                deliverForm:{
                    dgList:[],
                    remark:''
                },

                rules4:{
                    purchaseRealPrice:[{required: true, trigger: 'blur' ,validator: isvalidatePurchaseRealPrice}],
                    remark:[{required: true, trigger: 'blur' ,message: '请输入调整原因',}],
                },
                moresuCouponInfo:[],
                showPriceChange:false,
                changePriceList:[ ],
                btnLoading4:false,
                fhycList:[],
                wList:[],

                btnLoadingZj:false,
                dialogVisibleZj:false,
                btnLoadingZj2:false,
                remarkZj:'',

                payContent:'',
                upUrl:'',
                dialogVisiblePz:false,
                orderPayId:'',
                uploadToken:{
                  token:'',
                },
                imgDomain:'',

            }
        },
        components:{
          cancelClick,
          crmTag,
        },
        computed: {
            ...mapGetters([
                'name',
                'mobile',
                'userId',
                'isMange',
            ]),
            isCanContactsByAdd() {
                if(this.roles.indexOf("contactsByAdd") != -1){
                    return true
                }else{
                    return false
                }
            },
            isCanContactsByEdit(){
                if(this.roles.indexOf("contactsByEdit") != -1){
                    return true
                }else{
                    return false
                }
            },
            isCanTrackingByAdd(){
                if(this.roles.indexOf("trackingByAdd") != -1){
                    return true
                }else{
                    return false
                }
            },
            isCanTrackingByEdit(){
                if(this.roles.indexOf("trackingByEdit") != -1){
                    return true
                }else{
                    return false
                }
            },
            isCanTrackingDelete(){
                if(this.roles.indexOf("trackingDelete") != -1){
                    return true
                }else{
                    return false
                }
            },
            isCanMaterialByAdd(){
                if(this.roles.indexOf("materialByAdd") != -1){
                    return true
                }else{
                    return false
                }
            },
            isCanMaterialByEdit(){
                if(this.roles.indexOf("materialByEdit") != -1){
                    return true
                }else{
                    return false
                }
            },
            isCanMaterialDelete(){
                if(this.roles.indexOf("materialDelete") != -1){
                    return true
                }else{
                    return false
                }
            },

            changeRealPrice(){
                if(this.roles.indexOf("changeRealPrice") != -1){
                    return true
                }else{
                    return false
                }
            },

            isNeedRecheck(){
                let isCheck = 0
                this.deliverForm.dgList.forEach((el)=>{
                    console.log(el)
                    if(el.isNeedRecheck == 1){
                        isCheck = 1
                    }
                });
                return isCheck == 1 ? true : false
            },

        },
        created() {
            this.getRemarkList();
            this.getPageInfo();
            this.getCustomerSettingList();
            this.getOrdersGoodsConfig();
            this.getOrdDeliverGoods();
            this.getfhycList();
            this.getWList();
            this.pasteImage();
        },
        filters: {
            fifpredictPrice(item,key){
              let goodsPrice = item.goodsPrice ? parseFloat(item.goodsPrice) : 0;
              let pumsPrice = item[key]? parseFloat(item[key]) : 0;
              let inputFreight = item.inputFreight ? parseFloat(item.inputFreight) : 0;
              let consultation = item.consultation ? parseFloat(item.consultation) : 0;
              let goodsNum = item.goodsNum ? parseFloat(item.goodsNum) : 0;
              if(pumsPrice != 0){
                return ((goodsPrice-pumsPrice-inputFreight-consultation)*goodsNum).toFixed(3)
              }else{
                return '--'
              }

            },
            formatTime(time) {
                let date = new Date(time);
                return formatDate(date, 'yyyy-MM-dd')
            },
            filtersTime(time){
                let h = parseInt(time / 3600, 10);
                let n = parseInt((time - h * 3600) / 60, 10);
                let s = time % 60;
                let r = "";
                r = h == 0 ? r : h + "小时";
                r = (n == 0 && s == 0) ? r : r + n + "分";
                r = s ==0 ? r : r + s + "秒";
                return r;
            },
            fifterPriceType(val,purchaseActualPrice,consultation,goodsNum,freight,freightType,deliverType){
                let val1 = val ? val : 0;
                let purchaseActualPrice1 = purchaseActualPrice ? parseFloat(purchaseActualPrice) : 0;
                let consultation1 = consultation? parseFloat(consultation) : 0;
                let goodsNum1 = goodsNum ? parseFloat(goodsNum) : 0;
                if(deliverType == '退货单'){
                  goodsNum1 = goodsNum1*-1
                }
                let freight1 = freight ? parseFloat(freight) : 0;
                if(freightType != '销售承担'){
                    freight1 = 0
                }
                if(deliverType == '退货单'){
                  return ((val1 - purchaseActualPrice1 - consultation1)*goodsNum1 + freight1).toFixed(0)
                }else{
                  return ((val1 - purchaseActualPrice1 - consultation1)*goodsNum1 - freight1).toFixed(0)
                }
            },
            fifterPriceTypeDun(val,purchaseActualPrice,consultation,goodsNum,freight,freightType,deliverType){
                let val1 = val ? val : 0;
                let purchaseActualPrice1 = purchaseActualPrice ? parseFloat(purchaseActualPrice) : 0;
                let consultation1 = consultation? parseFloat(consultation) : 0;
                let goodsNum1 = goodsNum ? parseFloat(goodsNum) : 0;
                let goodsNum2 = goodsNum ? parseFloat(goodsNum) : 0;
                if(deliverType == '退货单'){
                  goodsNum2 = goodsNum2*-1
                }
                let freight1 = freight ? parseFloat(freight) : 0;
                if(freightType != '销售承担'){
                    freight1 = 0
                }
                if(deliverType == '退货单'){
                  return (((val1 - purchaseActualPrice1 - consultation1)*goodsNum2 + freight1)/goodsNum1).toFixed(2)
                }else{
                  return (((val1 - purchaseActualPrice1 - consultation1)*goodsNum2 - freight1)/goodsNum1).toFixed(2)
                }
            },
            fifterPrice(val,purchaseActualPrice,consultation,goodsNum,freight,freightType){
                let val1 = val ? val : 0;
                let purchaseActualPrice1 = purchaseActualPrice ? parseFloat(purchaseActualPrice) : 0;
                let consultation1 = consultation? parseFloat(consultation) : 0;
                let goodsNum1 = goodsNum ? parseFloat(goodsNum) : 0;
                let freight1 = freight ? parseFloat(freight) : 0;
                if(freightType != 'sale'){
                  freight1 = 0
                }
                return ((val1 - purchaseActualPrice1 - consultation1)*goodsNum1 - freight1).toFixed(0)
            },
            fifterAllSaleProfit(val,orderState){
                if(val){
                    let sumList = [];
                    let sum = 0;
                    val.forEach((el)=>{
                        let goodsPrice1 = el.goodsPrice ? parseFloat(el.goodsPrice) : 0;
                        let purchaseActualPrice1;
                        if(orderState == 20){
                            purchaseActualPrice1 = el.purchasePrice ? parseFloat(el.purchasePrice) : 0;
                        }else{
                            purchaseActualPrice1 = el.purchasePrice ? parseFloat(el.purchasePrice) : 0;
                        }

                        let consultation1 = el.consultation? parseFloat(el.consultation) : 0;
                        let goodsNum1 = el.goodsNum ? parseFloat(el.goodsNum) : 0;
                        let freight1 = el.inputFreight ? parseFloat(el.inputFreight) : 0;
                        if(el.freightType != 'sale' ){
                          freight1 = 0
                        }
                        sumList.push((goodsPrice1 - purchaseActualPrice1 - consultation1)*goodsNum1 - freight1)
                    });
                    sumList.forEach((e)=>{
                        sum = sum + e
                    });
                    return sum.toFixed(0)
                }else{
                    return ''
                }

            },
            fiFreight(val){
                let sum = 0;
                if(val){
                    val.forEach((el)=>{
                        let goodsFreight = el.goodsFreight ? el.goodsFreight : 0;
                        sum = sum + parseFloat(goodsFreight)
                    });
                    return sum.toFixed(2)
                }else{
                    return 0
                }

            },
            fifterTimeSure(val){
                if(val == 1){
                    return '是'
                }else if(val == 2){
                    return '否'
                }
            },

            fiffinanceState (val){
                if(val == 0){
                    return '未审核'
                }else if(val == 1){
                    return '已审核 '
                }else if(val == 2){
                    return '已关闭'
                }else if(val == 3){
                  return '部分审核'
                }
            },
            fifFreightType(val){
              if(val == 'sale'){
                return '销售承担运费'
              }else if(val == 'purchase'){
                return '采购承担运费 '
              }
            },
          fiftransactionType(val){
            if(val == 'BANK_PAY'){
              return '银行汇款'
            }else if(val == 'COD_PAY'){
              return '货到付款 '
            }else if(val == 'DEPOSIT_PAY'){
              return '定金 '
            }else if(val == 'OTHER_PAY'){
              return '其它 '
            }else if(val == 'PERIOD_PAY'){
              return '账期 '
            }
          },
        },
        methods:{
          /*取消合同*/
          cancelOrderClick(){
            this.$refs.cancelClick.showPop(this.orderInfo)
          },

          //取消合同更新
          cancelUpdate(nowTime){
            this.getPageInfo();
            this.showPalceTime(nowTime)
          },
          //获取七牛TOKEN
          getUploadToken(){
            return getQiniuToken().then((res)=>{
              this.uploadToken.token = res.token
              this.imgDomain = res.domain
            })
          },
          //粘贴图片
          pasteImage() {
            let upUrl = ''
            document.addEventListener('paste',(event)=> {
              let isChrome = false;
              if (event.clipboardData || event.originalEvent) {
                //某些chrome版本使用的是event.originalEvent
                let clipboardData = (event.clipboardData || event.originalEvent.clipboardData);
                if(clipboardData.items){
                  // for chrome
                  let  items = clipboardData.items, len = items.length, blob = null;
                  isChrome = true;
                  for (let i = 0; i < len; i++) {
                    if (items[i].type.indexOf("image") !== -1) {
                      //getAsFile() 此方法只是living standard firefox ie11 并不支持
                      blob = items[i].getAsFile();
                    }
                  }
                  if(blob!==null){
                    let blobUrl=URL.createObjectURL(blob);
                    // this.priceForm.blobImg = blobUrl;
                    // document.getElementById("imgNode").src=blobUrl;
                    let reader = new FileReader();
                    // base64码显示

                    reader.onload =  (event)=> {
                      // event.target.result 即为图片的Base64编码字符串
                      // this.payContent = event.target.result;
                      // document.getElementById("imgNode").src=base64_str;
                      this.upUrl = event.target.result;
                    };
                    reader.readAsDataURL(blob);
                  }

                }
              }
            });
          },

          //显示上传
          showPz(item){
            this.getUploadToken().then(()=>{
              this.orderPayId = item.orderPayId
              this.payContent = '';
              this.dialogVisiblePz = true;
            })

          },
          handleConfirmPz(){
             if(this.payContent == ''){
               this.$message.error("请上传凭证！")
               return false
             }
            this.dialogVisiblePz = false
            setPayReceipt({orderPayId:this.orderPayId,payContent:this.payContent}).then((res)=>{
              this.$message.success("请上传成功！")
                  this.getPageInfo()
            })
          },

          //采购总监审核
          examineZj(){
              this.dialogVisibleZj = true;
              this.remarkZj = ''
          },
          //提交采购总监审核
          handleConfirmZj(type){
            if(type == 2 && this.remarkZj == ''){
              this.$message.error('请输入备注!')
              return false
            }
            if(type == 2){
              this.btnLoadingZj2 = true;
            }else{
              this.btnLoadingZj = true;
            }

            let data = {};
            data.orderId = this.orderId;
            data.action = type == 2 ? 'back' : 'purchaseEnter';
            data.remark = this.remarkZj;
            postOrdersprocess(data).then(()=>{
              this.btnLoadingZj = false;
              this.btnLoadingZj2 = false
              this.$message({
                message: '操作成功',
                type: 'success'
              });
              this.getPageInfo();
              this.dialogVisibleZj = false
            }).catch(()=>{
              this.btnLoadingZj = false;
              this.btnLoadingZj2 = false
            })
          },

          getWList(){
            getWarehouseList().then((res)=>{
              this.wList = res
            })
          },
          //获取延迟原因
          getfhycList(){
            delayReasonList({orderId:this.orderId}).then((res)=>{
              this.fhycList = res;
            })

          },
            //去订单详情
            toOrderDetail(item){
                let routeData = this.$router.resolve({name:'purchaseDetail',query:{id:item.orderId,type:'see'}});
                window.open(routeData.href);
            },
            //获取发货信息
            getOrdDeliverGoods(){
                ordDeliverGoods({orderId:this.orderId}).then((res)=>{
                    this.deliverForm.dgList = res;
                })
            },
            //去客户详情页
            toDetail(tab){
                if(tab ==10){
                    this.$router.push({name:'customerDetail',query:{id:this.orderInfo.customerId,tab:tab}})
                }else{
                    this.$router.push({name:'customerDetail',query:{id:this.orderInfo.customerId}})
                }

            },
            //同步SAP数据
            // syncOneOrder(){
            //     this.btnLoading5 = true;
            //     getSyncOneOrder({orderId:this.orderId}).then((res)=>{
            //         this.$message({
            //             message: '同步成功',
            //             type: 'success'
            //         });
            //         this.btnLoading5 = false;
            //         this.getPageInfo()
            //     }).catch(()=>{
            //         this.btnLoading5 = false;
            //     })
            // },
            //去打印机
            toPrint(type){
                let name = 'printing'
                if(this.orderInfo.transactionType == '锡商支付'){
                  name = 'printingXs'
                }
                this.$router.push({name:name,query:{id:this.$route.query.id,type:type,isPums:'1'}})
            },
            //限额判断
            isImit(item,val){
                if(val){
                    searchLimit({goodsKingId:item.goodsKingId,sendDate:val}).then((res)=>{
                        let limitNum = res.limitNum ? res.limitNum : '不限';
                        if(res.limitNum && parseFloat(item.goodsNum) > parseFloat(limitNum)){
                            let msg = '此商品当日订单总量为'+res.expectSendNum+'吨，限额'+res.limitNum+'吨，你确认此操作吗？';
                            this.$alert(msg, '警告', {
                                confirmButtonText: '确定',
                            });
                        }

                    })
                }

            },
            //查看发货单
            toDeliverCon(item){
                let routeData = this.$router.resolve({name:'deliverCon',query:{id:item.deliverId,type:'see'}});
                window.open(routeData.href);
            },
            fullImg(src){
                this.dialogVisible4 = true;
                this.fullSrc = src;
            },
            //获取备注类型
            getRemarkList(){
                getCustomerSetting().then((res) => {
                    res.forEach((el) => {
                        if (el.cdtCode == 'remark_type_str') {
                            this.remarkList = el.data
                        }
                    });
                })
            },
            //显示备注弹窗
            showDialogRemark(){
                this.dialogVisible3 = true;
                this.remarkForm.remark = '';
            },
            //关闭备注弹窗
            handleClose3(){
                this.dialogVisible3 = false;
                this.$refs.remarkForm.clearValidate();
            },
            //提交备注
            handleConfirm3(){
                this.$refs['remarkForm'].validate((valid) => {
                    if (valid) {
                        this.btnLoading3 = true;
                        ordersRemark({orderId:this.orderId,remark:this.remarkForm.remark,remarkTypeStr:this.remarkForm.remarkTypeStr}).then(()=>{
                            this.btnLoading3 = false;
                            this.dialogVisible3 = false;
                            this.getPageInfo()
                        }).catch(()=>{
                            this.btnLoading3 = false;
                        })
                    }
                })
            },
            //切换log类型
            handleSelectLog(key){
                this.logTab = key;
                this.orderLogs = [];
                if(key==1){
                    this.orderLogs = this.orderInfo.orderLogs.orderLogByA
                }else if(key == 2){
                    this.orderLogs = this.orderInfo.orderLogs.orderLogByB
                }else{
                    this.orderLogs = this.orderInfo.orderLogs.orderLogByC
                }
            },

            //返回
            // goBlack(){
            //     this.$router.go(-1)
            // },
            //显示调整弹窗
            showDialog(item){
                this.curGoods = JSON.parse(JSON.stringify(item));
                this.goodsForm.purchaseActualPrice = item.purchaseActualPrice;
                this.goodsForm.remark = '';
                this.dialogVisible = true;
            },
            //关闭调整弹窗之前
            beforeClose2(){
                this.dialogVisible = false;
                this.$refs.goodsForm.clearValidate();
            },

            //关闭调整弹窗弹窗
            handleClose2(){
                this.dialogVisible = false;
                this.$refs.goodsForm.clearValidate();
            },

            //提交调整
            handleConfirm2(type){
                this.$refs.deliverForm.validate((valid) => {
                    if (valid) {
                        let data = {};
                        data.orderId = this.orderId;
                        data.remark = this.deliverForm.remark;
                        data.dgList = [];
                        if(type == 'deliverRecheck'){
                            data.deliverRecheck = 1;
                        }
                        let alertNum = 0;
                        this.deliverForm.dgList.forEach((el)=>{
                            if(el.isDelete == 0) {
                                data.dgList.push({
                                    dgId: el.dgId,
                                    purchaseRealPrice: el.purchaseRealPrice,
                                });
                                let num = parseFloat(el.purchaseRealPrice) - parseFloat(el.goodsPrice);
                                if(num > 500 || num < -500){
                                    alertNum = alertNum + 1;
                                }
                            }
                        });
                        if(alertNum > 0){
                            this.$confirm('采购底价上下浮动超过500!', '提示', {
                                confirmButtonText: '确定',
                                type: 'warning',
                                showCancelButton:false,
                            }).then(() => {
                                if(type == 'deliverRecheck'){
                                    this.btnLoading4 = true;
                                }else{
                                    this.btnLoading = true;
                                }

                                editPurchaseRealPrice(data).then(()=>{
                                    this.btnLoading = false;
                                    this.btnLoading4 = false;
                                    this.$message({
                                        message: '底价修改成功',
                                        type: 'success'
                                    });
                                    // this.handleClose2();
                                    this.getPageInfo();
                                }).catch(()=>{
                                    this.btnLoading = false;
                                    this.btnLoading4 = false;
                                })
                            }).catch(() => {
                            });

                        }else{
                            if(type == 'deliverRecheck'){
                                this.btnLoading4 = true;
                            }else{
                                this.btnLoading = true;
                            }
                            editPurchaseRealPrice(data).then(()=>{
                                this.btnLoading = false;
                                this.btnLoading4 = false;
                                this.$message({
                                    message: '底价修改成功',
                                    type: 'success'
                                });
                                // this.handleClose2();
                                this.getPageInfo();
                            }).catch(()=>{
                                this.btnLoading = false;
                                this.btnLoading4 = false;
                            })
                        }
                    }
                })
            },

            //发货配置
            getOrdersGoodsConfig(){
                ordersGoodsConfig().then((res)=>{
                    this.priceTypes = res.priceType;
                    this.sendTypes = res.sendType;
                })
            },

            //确认提交
            handleConfirm(){
                console.log("asdfasdfasd")
                let p1=new Promise((resolve,reject)=>{
                     this.$refs['basic'].validate(valid=>{
                            if(valid) {console.log("1111");resolve()} else {console.log("222");reject()}
                        })
                })

                let p2=new Promise((resolve,reject)=>{
                     this.$refs['orderInfo'].validate(valid=>{
                        if(valid) {console.log("444");resolve()} else {console.log("333");reject()}
                    })
                })
                Promise.all([p1,p2]).then(()=>{
                       let alertNum = 0;
                       let showMaoLi = this.totalMaoLi();
                       // let text = this.isUpdatePrice() && (this.orderInfo.orderState == 20) ? '<br/>此次审核涉及到摩塑网商品价格<span style="font-size:16px;color:red;font-weight:bold;padding:0 8px">更新</span>。' :''
                          let text = '';
                          let msg = '<div>合同总数量<span style="font-size:16px;color:red;font-weight:bold;padding:0 8px">'+ this.orderInfo.orderGoodsNumber +'</span>吨，总毛利<span style="font-size:16px;color:red;font-weight:bold;padding:0 8px">'+ showMaoLi+'</span>元。'+ text +'<br/>请仔细核对后提交!</div>'
                       this.$confirm(msg, '提示', {
                              confirmButtonText: '确定',
                              cancelButtonText: '取消',
                              dangerouslyUseHTMLString: true,
                              type: 'warning'
                          }).then(() => {
                            this.ajaxPass();
                              // this.isUpPrice()
                          }).catch(() => {
                          });
                       // this.orderInfo.orderGoodsData.forEach((el)=>{
                       //     let num = parseFloat(el.goodsPrice) - parseFloat(el.inputFreight)/el.goodsNum  - parseFloat(el.purchasePrice) - parseFloat(el.consultation);
                       //     if(num < 0){
                       //         alertNum = alertNum + 1;
                       //     }
                       // });
                       // if(alertNum > 0 && (this.orderInfo.orderState == 20 || this.orderInfo.orderState == 25) ){  //采购员确认状态下，销售单价-运费-采购底价-杂费(装卸费)小于0时，弹出确认框。
                       //     this.$confirm('当前有商品毛利小于零，确定提交吗?', '提示', {
                       //         confirmButtonText: '确定',
                       //         cancelButtonText: '取消',
                       //         type: 'warning'
                       //     }).then(() => {
                       //         this.isUpPrice()
                       //     }).catch(() => {
                       //     });
                       // }else{
                       //     this.isUpPrice()
                       // }
                }).catch(()=>{
                    console.log('验证不通过')
                })
            },

           //计算总毛利
          totalMaoLi(){
            let sumList = [];
            let sum = 0;
            this.orderInfo.orderGoodsData.forEach((el)=>{
              let goodsPrice1 = el.goodsPrice ? parseFloat(el.goodsPrice) : 0;
              let purchaseActualPrice1;
              purchaseActualPrice1 = el.purchasePrice ? parseFloat(el.purchasePrice) : 0;

              let consultation1 = el.consultation? parseFloat(el.consultation) : 0;
              let goodsNum1 = el.goodsNum ? parseFloat(el.goodsNum) : 0;
              let freight1 = el.inputFreight ? parseFloat(el.inputFreight) : 0;
              sumList.push((goodsPrice1 - purchaseActualPrice1 - consultation1)*goodsNum1 - freight1)
            });
            sumList.forEach((e)=>{
              sum = sum + e
            });
            return sum.toFixed(0)
          },
            //价格更新询问
            isUpPrice(){
                if(this.isUpdatePrice() && (this.orderInfo.orderState == 20) && this.orderInfo.isNeedMyCheck){
                    this.$confirm('此次审核涉及到摩塑网商品价格更新，请仔细核对后提交!', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        this.ajaxPass()
                    }).catch(() => {
                    });
                }else{
                    this.ajaxPass()
                }
            },

            //采购审核提交
            ajaxPass(){
                let data = {};
                data.orderId = this.orderId;
                data.customerIndustry = this.orderInfo.customerIndustry.cdd_id;
                data.action = 'purchaseEnter';
                if(this.orderInfo.orderState == 5){
                  data.action = 'priceEnter';
                }
                data.remark = this.pumsRemark;
                data.customerLabel = this.orderInfo.customerLabel;
                data.isSpecialOrder = this.orderInfo.isSpecialOrder;
                data.goods = [];
                let alerNum = 0;
                this.orderInfo.orderGoodsData.forEach((el)=>{
                    let c = {
                        ogId:el.ogId,
                        purchasePrice:el.purchasePrice,
                        priceType:el.priceType,
                        sendType:el.sendType,
                        // changePrice:el.changePrice,
                        // isChangePrice:el.isChangePrice,
                        inputFreight:el.inputFreight,
                        warehouseName:el.warehouseName,
                        warehouseNameRemark:el.warehouseNameRemark,
                        sendDate1:el.sendDate1,
                        sendRate1:el.sendRate1,
                        sendDate2:el.sendDate2,
                        sendRate2:el.sendRate2,
                        sendDate3:el.sendDate3,
                        sendRate3:el.sendRate3,
                        predictPrice:el.predictPrice,
                        actualPrice:el.actualPrice,
                        freightType:el.remark.indexOf('自提') == -1 ? el.freightType : ''
                    };
                    let num = parseFloat(el.purchasePrice) - parseFloat(el.goodsPrice);
                    if(num > 500 || num < -500){
                        alerNum = alerNum + 1;
                    }
                    // if((this.orderInfo.orderState == 25 || this.orderInfo.orderState == 20) && this.orderInfo.isNeedMyCheck){
                    //     c.isChangePrice = el.isChangePrice ? 0 :1;
                    // };
                    data.goods.push(c);
                });
                if(this.orderInfo.isCanChangeOrderType == 1){
                    data.orderType = this.orderInfo.orderType
                }
              this.btnLoading = true;
              postOrdersprocess(data).then((res)=>{
                this.btnLoading = false;
                this.$message({
                  message: '操作成功',
                  type: 'success'
                });
                // this.$router.go(-1)
                // let moresuGoodsId = [];
                // this.orderInfo.orderGoodsData.forEach((el)=>{
                //   if(!el.isChangePrice ){
                //     moresuGoodsId.push(el.moresuGoodsId)
                //   }
                // });
                // console.log("moresuGoodsId",moresuGoodsId)
                // if(moresuGoodsId.length > 0){
                //   moresuGoodsPrice({moresuGoodsId:moresuGoodsId.join(",")}).then((res)=>{
                //     this.changePriceList = res;
                //     this.showPriceChange = true;
                //   })
                // }
                this.getPageInfo();
                this.showPalceTime(res.nowTime)
              }).catch(()=>{
                this.btnLoading = false;
              })
                console.log("data",data)
                // if(alerNum > 0){
                //     this.$confirm('预估底价上下浮动超过500!', '提示', {
                //         confirmButtonText: '确定',
                //         type: 'warning',
                //         showCancelButton:false,
                //     }).then(() => {
                //         this.btnLoading = true;
                //         postOrdersprocess(data).then((res)=>{
                //             this.btnLoading = false;
                //             this.$message({
                //                 message: '操作成功',
                //                 type: 'success'
                //             });
                //             // this.$router.go(-1)
                //             let moresuGoodsId = [];
                //             this.orderInfo.orderGoodsData.forEach((el)=>{
                //                 if(!el.isChangePrice ){
                //                     moresuGoodsId.push(el.moresuGoodsId)
                //                 }
                //             });
                //             if(moresuGoodsId.length > 0){
                //                 moresuGoodsPrice({moresuGoodsId:moresuGoodsId.join(",")}).then((res)=>{
                //                     this.changePriceList = res;
                //                     this.showPriceChange = true;
                //                 })
                //             }
                //             this.getPageInfo();
                //             this.showPalceTime(res.nowTime)
                //         }).catch(()=>{
                //             this.btnLoading = false;
                //         })
                //     }).catch(() => {
                //     });
                //
                // }else{
                //     this.btnLoading = true;
                //     postOrdersprocess(data).then((res)=>{
                //         this.btnLoading = false;
                //         this.$message({
                //             message: '操作成功',
                //             type: 'success'
                //         });
                //         // this.$router.go(-1)
                //         let moresuGoodsId = [];
                //         this.orderInfo.orderGoodsData.forEach((el)=>{
                //             if(!el.isChangePrice ){
                //                 moresuGoodsId.push(el.moresuGoodsId)
                //             }
                //         });
                //         console.log("moresuGoodsId",moresuGoodsId)
                //         if(moresuGoodsId.length > 0){
                //             moresuGoodsPrice({moresuGoodsId:moresuGoodsId.join(",")}).then((res)=>{
                //                 this.changePriceList = res;
                //                 this.showPriceChange = true;
                //             })
                //         }
                //         this.getPageInfo();
                //         this.showPalceTime(res.nowTime)
                //     }).catch(()=>{
                //         this.btnLoading = false;
                //     })
                // }

            },

          //显示处理时长
          showPalceTime(nowTime){
            let oldTime = formatDate(new Date(parseInt(this.orderInfo.lastCheckTime*1000)),'MM-dd hh:mm')
            let time = formatDate(new Date(parseInt(nowTime*1000)),'MM-dd hh:mm');
            let countTime = showtime(parseInt(this.orderInfo.lastCheckTime*1000),parseInt(nowTime*1000))
            console.log("time",time)
            console.log("oldTime",oldTime)
            console.log("countTime",countTime);
            this.$alert('<div>此合同于 '+ oldTime +' 流转转您的节点</div><div style="padding:16px 0">您于 '+ time +' 处理完毕。</div><div>此合同在您的节点耗时<span style="font-size:16px;font-weight: bold;color:red;padding-left:5px">'+countTime+'</span></div>', '流转统计', {
              showConfirmButton:false,
              dangerouslyUseHTMLString: true,
              closeOnClickModal:true,
            })
            setTimeout(function() {
              let a = document.body.getElementsByClassName("v-modal")[0];
              a.click();
            }, 6000);
          },

            //是否有价格更新
            isUpdatePrice(){
                let n = 0;
                this.orderInfo.orderGoodsData.forEach((el)=>{
                        if(!el.isChangePrice ){
                            n = n+1
                        }
                });
                return n > 0 ;
            },

            //回退
            blackOrder(){
                if(this.pumsRemark==''){
                    this.$message.error('回退时，操作备注必需填写！');
                    return false
                }
                this.btnLoading1 = true;
                let data = {};
                data.orderId = this.orderId;
                data.action = 'back';
                data.remark = this.pumsRemark;
                postOrdersprocess(data).then((res)=>{
                    this.btnLoading1 = false;
                    this.$message({
                        message: '合同已回退成功',
                        type: 'success'
                    });
                    // this.$router.go(-1);
                    this.getPageInfo();
                    this.showPalceTime(res.nowTime)
                }).catch(()=>{
                    this.btnLoading1 = false;
                })
            },

            //获取合同详情
            getPageInfo(){
                this.loading = true;
                getOrdersShow({orderId:this.orderId}).then(res=>{
                    this.orderInfo = res;
                    this.orderInfo.orderGoodsData.forEach((el)=>{
                        el.olderInputFreight = el.inputFreight;
                        if(res.orderState == 20){
                          el.freightType = el.freightType == '' ? 'sale' : el.freightType
                        }
                    })
                    this.orderInfoSaleProfit = res.saleProfit;
                    this.$set(this.orderInfo,"priceRemark",'');
                    this.handleSelectLog(this.logTab);
                    this.moresuCouponInfo = [];
                    if(this.orderInfo.moresuCouponInfo != null){
                        this.moresuCouponInfo.push(this.orderInfo.moresuCouponInfo);
                    }
                    this.loading = false;
                });
            },


            //获取客户配置
            getCustomerSettingList() {
                getCustomerSetting().then((res) => {
                    res.forEach((el) => {
                        if (el.cdtCode == 'customer_industry') {
                            this.customerIndustryList = el.data;
                        }
                    });
                })
            },
        },
        watch:{
            '$route'(to,from){
                this.orderId = this.$route.query.id;
                this.getRemarkList();
                this.getPageInfo();
                this.getCustomerSettingList();
                this.getOrdersGoodsConfig();
                this.getWList()
            },

          upUrl(){
            let data = {};
            let pic = this.upUrl.replace(/^.*?base64,/, '');
            data.pic = pic;
            data.token = this.uploadToken.token;
            data.imgDomain = this.imgDomain;
            uploadBase64(data).then((res)=>{
              if(res.src){
                this.payContent = res.src;
              }else{
                this.$message.error('上传失败')
              }
            });
          },
        },
    }
</script>

<style  lang="scss">
  .detail-container {
    width: 90%;
    padding: 20px 20px 20px 20px;
    margin: 20px auto;
    .el-card__header{
      background: #f8f8f8;
      .kehu-name{
        display: inline-block;
        font-size:14px;
        vertical-align: middle;
      }
      .kehu-label{
        font-size:12px;
        vertical-align: middle;
        display: inline-block;
        margin-left:15px;
        color: #409eff;
        background: #ecf5ff;
        border: 1px solid #b3d8ff;
        height:24px;
        line-height: 24px;
        padding:0 10px;
        border-radius: 5px;
      }
      .kehu-info{
        text-align: right;
        font-size: 12px;
        color:#333;
        line-height: 20px;
        span{
          padding-left:16px;
        }
      }
    }
    .operate-container {
      background: #F2F6FC;
      height: 80px;
      margin: -20px -20px 0;
      line-height: 80px;
    }
  }
  .price-block{
    font-size:12px;
    line-height:30px;
    .lab{
      display: inline-block;
      width:100px;
      text-align: right;
    }
    .text{
      display: inline-block;
    }
  }
  .minRoW .el-form-item{
      margin-bottom:5px;
  }
  .tongJitable{
      border-left:1px solid #EBEEF5;
      border-top:1px solid #EBEEF5;
      font-size:12px;
      margin-bottom:20px;
      td{
          border-right:1px solid #EBEEF5;
          border-bottom:1px solid #EBEEF5;
          div.tddiv{
              min-height: 30px;
              line-height: 30px;
              padding:0 5px;
              text-align: center;
              white-space:  nowrap
          }
      }
      .bgtd{
          background: #f5f7fa;
      }
  }
  .title-tab{
      border-radius: 8px;
      background: #eee;
      margin-left: 10px;
      display: inline-block;
      vertical-align: middle;
      line-height: 20px;
      padding: 0 5px;
      color: #666;
  }
    .blurth{
        background:#e21717;
       color:#fff
    }
</style>
